package diseaseandcureadministration.cure;

import diseaseandcureadministration.Patient;

/**
 * Abstract class Cure defines the methods for the concrete Cure classes
 * 
 * @author Peter Tolstrup Aagesen, ptaa@itu.dk
 *
 */
public abstract class Cure 
{
	//Instance variables
	private String _name;
	private int _healFactor;
	
	/**
	 * administer is a method for supplying the cure to the Patient
	 * administer must be implemented/overridden by all concrete 
	 * cure classes
	 * @param patient
	 */
	public abstract void administer(Patient patient);
	
	/**
	 * setName is a setter for name instance variable
	 * @param name of the cure name
	 */
	protected void setName(String name)
	{
		_name = name;
	}

	/**
	 * getName is a getter for name instance variable
	 * @return the name of the cure
	 */
	public String getName()
	{
		return _name;
	}
	
	/**
	 * setHealFactor is a setter for healFactor instance variable
	 * @param healFactor set healFactor
	 */
	protected void setHealFactor(int healFactor) 
	{
		_healFactor = healFactor;
	}
	
	/**
	 * getHealFactor is a getter for healFactor instance variable 
	 * @return healFactor
	 */
	public int getHealFactor()
	{
		return _healFactor;
	}
	
	@Override
	public boolean equals(Object o)
	{
		boolean isEqual = false;
		
		if(o instanceof Cure && o != null)
		{
			Cure other = (Cure) o;
			
			if(other.getName().equals(_name) && other.getHealFactor() == _healFactor)
			{
				isEqual = true;
			}
		}
			
		return isEqual;
	}
	
	@Override
	public String toString()
	{
		String cureAsString = getName() + ", " + getHealFactor();
		return cureAsString;
	}
	
}
